package jiachunlei.composite;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/12/9 20:07
 */
public class Leaf extends Component
{
    public Leaf(String name)
    {
        super(name);
    }

    @Override
    public void add(Component c)
    {
        System.out.println("leaf no add");
    }

    @Override
    public void remove(Component c)
    {
        System.out.println("leaf no remove");
    }

    @Override
    public void display(int depth)
    {
        StringBuffer sb = new StringBuffer("-");
        for (int i = 0; i < depth; i++)
        {
            sb.append("-");
        }
        System.out.println(sb.toString() + name);
    }
}
